package com.sh.ssao.lottery.config.utils;

import java.util.LinkedHashSet;
import java.util.Random;
import java.util.Set;

public class GeneratorUtil {
    /**
     * int min = 1;
     * int max = 36;
     * int total = 22;
     * @param min 生成最小值
     * @param max 生成最大值
     * @param total 生成总个数
     * @return
     */
    public static Set<Integer> getLuckNum(int min,int max,int total){
        Random r = new Random();

        Set<Integer> ar = new LinkedHashSet<>();
        while (ar.size() < total){
            int i=r.nextInt(max-min+1)+min;
            ar.add(i);
        }
        //第一轮获奖名单
        for (Integer integer : ar) {
            System.out.print(integer+"\t");
        }

        return ar;
    }

    public static void main(String[] args) {
        new GeneratorUtil().getLuckNum(1,36,22);
    }
}
